<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<ul id="ul">
		<li>1</li>
		<li>2</li>
		<li>3</li>
		<li>4</li>
	</ul>
	<script>
        // 类型判断
        const isType = (v) => {
        	const r = Object.prototype.toString.call(v)
        	return r.slice(7, r.length-1).toLowerCase()
        }
        
		console.log(new Date() instanceof Object)
		function rec(obj) {
			if (isType(obj) !== 'object' || isType(obj) !== 'array') {
				return obj
			}

			let result = Array.isArray(obj) ? [] : {}

		    for(let k in obj) {
		    	result[k] = rec(obj[k])
		    }

		    return result

		}
		const data = {a: 1, b: {
			e: new Date(),
			c: 1323,
			d: [1,3,['a','b']],
			f: function() {
				alert(1)
			}
		}}
		const res = rec(data)
		console.log(res.b.f())

	</script>
	
</body>
</html>